/**
 * File Comment: Ita a GUI
 */
package edu.gatech.oad.project.presentation;
//$codepro.audit.disable
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

import edu.gatech.oad.project.operations.users.User;

/**
 * This class is a panel that allows the user
 * to interact with the GUI to view his or her
 * income statement.
 * 
 * @author Group 17
 * @version 1
 */
public class SysAdminIncomeStatement extends JPanel {
  
  /**
   * Field driver: holds the Driver connected to the GUI
   */
  private Driver driver;
  
  /**
   * Field lblIncomeStatement: label
   */
  public JLabel lblIncomeStatement;
  
  /**
   * TEMPORARY
   */
  public JLabel lblSomeImageWill;
  
  /**
   * Field btnBackToHome: back button
   */
  public JButton btnBackToHome;

 /**
  * Constructor.
  * 
  * @param driver the Driver connected to the GUI
  * @param curUser the user interacting with the GUI
  */
 public SysAdminIncomeStatement(Driver driver, User curUser) {
   this.driver = driver;
  GridBagLayout gridBagLayout = new GridBagLayout();
  gridBagLayout.columnWidths = new int[]{0, 0, 0, 0, 0, 0, 0};
  gridBagLayout.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
  gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
  setLayout(gridBagLayout);
  
  lblIncomeStatement = new JLabel("Income Statement");
  lblIncomeStatement.setFont(new Font("Lucida Grande", Font.PLAIN, 30));
  GridBagConstraints gbc_lblIncomeStatement = new GridBagConstraints();
  gbc_lblIncomeStatement.insets = new Insets(0, 0, 5, 0);
  gbc_lblIncomeStatement.gridwidth = 8;
  gbc_lblIncomeStatement.gridx = 0;
  gbc_lblIncomeStatement.gridy = 0;
  add(lblIncomeStatement, gbc_lblIncomeStatement);
  
  //code will generate a chart of income statement
  lblSomeImageWill = new JLabel("Some Image will go here");
  GridBagConstraints gbc_lblSomeImageWill = new GridBagConstraints();
  gbc_lblSomeImageWill.gridwidth = 5;
  gbc_lblSomeImageWill.insets = new Insets(0, 0, 5, 5);
  gbc_lblSomeImageWill.gridx = 0;
  gbc_lblSomeImageWill.gridy = 2;
  add(lblSomeImageWill, gbc_lblSomeImageWill);
  
  btnBackToHome = new JButton("Back to Home");
  btnBackToHome.addActionListener(new ButtonListener(this));
  GridBagConstraints gbc_btnBackToHome = new GridBagConstraints();
  gbc_btnBackToHome.insets = new Insets(0, 0, 0, 5);
  gbc_btnBackToHome.gridx = 2;
  gbc_btnBackToHome.gridy = 8;
  add(btnBackToHome, gbc_btnBackToHome);
 } // end constructor method
 
 /**
  * Get the Driver.
  * 
  * @return the Driver connected to the GUI
  */
 public Driver getDriver()
 {
   return this.driver;
 } // end getDriver method

 /**
  * This private inner class implements ActionListener for btnBackToHome.
  * 
  * @author Group 17
  * @version 1
  */
 private class ButtonListener implements ActionListener
 {
   /**
    * Field is: the SysAdminIncomeStatement being used
    */
   private SysAdminIncomeStatement is;
   
   /**
    * Field driver: holds the Driver connected to the GUI
    */
   private Driver driver;
   
   /**
    * Constructor.
    * 
    * @param is the SysAdminIncomeStatement being used
    */
   private ButtonListener(SysAdminIncomeStatement is)
   {
     this.is = is;
     this.driver = is.getDriver();
   } // end constructor method
   
   /**
    * Default method for ActionListener.
    * 
    * @param e the ActionEvent triggering the ActionListener
    */
   public void actionPerformed(ActionEvent e)
   {
     this.driver.getFrame().setContentPane(new SysAdminHome(this.driver));
     this.driver.getFrame().pack();
   } // end actionPerformed method
 } // end ButtonListener class
} // end SysAdminIncomeStatement class